package com.suma.platform.core.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.nfsq.platform.utils.bean.ResultBean;
import com.suma.platform.core.mq.Producer;

import io.swagger.annotations.Api;

/**
 * @author suma
 * @date 2018/2/11 下午2:33
 */
@RestController
@RequestMapping(value = "/api/activemq")
@Api(value = "/activemq")
public class ActiveMqTestController {

	@Autowired
	private Producer producer;

	@RequestMapping(value = "/queue", method = { RequestMethod.GET, RequestMethod.POST })
	public ResultBean queue(String queueName, String msg) {
		producer.queue(queueName, msg);
		return new ResultBean();
	}

	@RequestMapping(value = "/topic", method = { RequestMethod.GET, RequestMethod.POST })
	public ResultBean topic(String topicName, String msg) {
		producer.topic(topicName, msg);
		return new ResultBean();
	}
}
